<template>
    <!-- v-loading="loadingProps.loading" :element-loading-text="loadingProps.text || '加载中...'" -->
    <div id="app">
        <el-select
            v-show="showPos"
            @change="routeFn"
            class="changeRoute"
            v-model="routeChange"
            placeholder="请选择"
            style="z-index: 100000000;"
        >
            <el-option
                v-for="item in routeOptions"
                :key="item.route"
                :label="item.label ||  item.route "
                :value="item.route"
            ></el-option>
        </el-select>
        <router-view></router-view>
        <errorDialog ref="errorRef"></errorDialog>
    </div>
</template>

<script>
import Vue from "vue";
import errorDialog from '@/components/errorDialog/indexComponents.vue'
export default {
    name: 'App',
    data() {
        return {
            // loadingProps: {
            //     loading: false,
            //     text:'加载中...',
            // },

            showPos: false,
            routeChange: '/baseInfo',
            routeOptions: [

                {
                    route: '/invoiceCollection',
                    label: '发票归集'
                },
                {
                    route: '/invoiceVericication',
                    label: '发票查验'
                },
                {
                    route: '/serviceInformationManage',
                    label: '4.1企业商品及服务信息管理'
                },
                {
                    route: '/userBasicInformation',
                    label: '4.2用户基本信息 -- 目前没用到 - 有树结构'
                },
                {
                    route: '/flowInvoice',
                    label: '4.3交易流水开票'
                },
                {
                    route: '/manualNegativeInvoice',
                    label: '4.4手工开具负数发票'
                },
                {
                    route: '/invoiceSummryConfirm',
                    label: '4.6发票汇总确认'
                },
                {
                    route: '/redConfirmApply',
                    label: '4.7红票确认单 申请'
                },
                {
                    route: '/redConfirmForm',
                    label: '4.8红票确认单 申请'
                },
                {
                    route: '/baseInfo',
                    label: '基本信息'
                },
                {
                    route: '/diskInfo',
                    label: '纳税人风险信息-diskInfo',
                },
                {
                    route: '/taxClass',
                    label: '税收分类编码信息-taxClass',

                },
                {
                    route: '/availableTax',
                    label: '可用税率信息-availableTax',

                },
                {
                    route: '/creditLimit',
                    label: '授信额度信息-creditLimit',

                },
                {
                    route: '/preShareCode',
                    label: '预赋码信息-preShareCode',

                },
                {
                    route: '/invoiceTemplate',
                    label: '版式文件信息-invoiceTemplate',

                },
                {
                    route: '/myAgent',
                    label: '预留项-纳税人风险信息-myAgent',

                },
                {
                    route: '/handleDetail',
                    label: '办理发票-页面-弹框转页面-handleDetail'
                },
                {
                    route: '/handInvoiceAdd',
                    label: '手工开具发票-handInvoiceAdd',

                },
                {
                    route: '/invoicedInfo',
                    label: '已开发票管理-invoicedInfo',

                },
                {
                    route: '/home',
                    label: '数电发票模块-home',

                },
                {
                    route: '/dev',
                    label: '流程部分-dev',
                },
                {
                  route: '/custom',
                  label: '客户基本信息-custom',
                }
            ],
        }
    },
    created(){

    },
    mounted() {
        if(process.env.NODE_ENV === 'development'){
            window.addEventListener('keyup', (event) => {
                this.showPos = true
                setTimeout(() => {
                    this.showPos = false
                }, 5000)
            })




        }
        // window.onresize = this.resetWindow;
        this.resetWindow2()

        Vue.prototype.$errorRef = this.$refs.errorRef;

    },
    methods: {
        routeFn(val) {
            this.$router.push({
                path: val,
            })
        },
        resetWindow2(){
            console.log(document.body.clientWidth)
            this.$store.commit('ChangeViewWidth',document.body.clientWidth || 0)
            // document.body.style.zoom = 2.0;
        }
        // resetWindow(){
        //         var browerWidth = window.innerWidth;
        //         var baseWidth = 1600; // 原本是1920,但是左侧挤压后只剩下这个值
        //         var zoomValue = browerWidth / baseWidth;
        //         console.log(browerWidth);
        //         console.log(baseWidth);
        //         console.log(zoomValue);
        //         document.getElementById("app").style.transform = 
        //             "scale(" + zoomValue + "," + zoomValue + ")";
        // }
    },
    beforeCreate() {
        Vue.prototype.$app = this
    },

    components:{
        errorDialog
    }
}
</script>

<style lang = "scss">
#app {
    width: 100%;
    height: 100vh;
    background: #fff;
    padding: 10px;
    font-size: 12px;

    .changeRoute {
        position: fixed;
        right: 10px;
        top: 20px;
        z-index: 1000;
    }
    // .contentWrap{
    //   display: flex;
    //   .rightContent{
    //     flex:1;
    //     height: calc(100vh - 60px);
    //   }
    // }
}
</style>
